using CoreManager.Models.DTOs;
using Microsoft.AspNetCore.Http;

namespace CoreManager.Services.Files
{
    /// <summary>
    /// 文件服务接口
    /// </summary>
    public interface IFileService
    {
        /// <summary>
        /// 上传单个文件
        /// </summary>
        /// <param name="file">文件</param>
        /// <param name="uploadDto">上传参数</param>
        /// <returns>文件上传结果</returns>
        Task<ApiResponse<FileUploadResultDto>> UploadFileAsync(IFormFile file, FileUploadDto uploadDto);

        /// <summary>
        /// 上传多个文件
        /// </summary>
        /// <param name="files">文件列表</param>
        /// <param name="uploadDto">上传参数</param>
        /// <returns>文件上传结果列表</returns>
        Task<ApiResponse<List<FileUploadResultDto>>> UploadFilesAsync(IFormFileCollection files, FileUploadDto uploadDto);

        /// <summary>
        /// 删除文件
        /// </summary>
        /// <param name="relativePath">文件相对路径</param>
        /// <returns>是否删除成功</returns>
        Task<ApiResponse<bool>> DeleteFileAsync(string relativePath);

        /// <summary>
        /// 批量删除文件
        /// </summary>
        /// <param name="relativePaths">文件相对路径列表</param>
        /// <returns>删除结果</returns>
        Task<ApiResponse<bool>> BatchDeleteFilesAsync(List<string> relativePaths);

        /// <summary>
        /// 获取文件信息
        /// </summary>
        /// <param name="relativePath">文件相对路径</param>
        /// <returns>文件信息</returns>
        Task<ApiResponse<FileInfoDto>> GetFileInfoAsync(string relativePath);

        /// <summary>
        /// 获取文件流
        /// </summary>
        /// <param name="relativePath">文件相对路径</param>
        /// <returns>文件流和内容类型</returns>
        Task<(Stream? stream, string contentType, string fileName)> GetFileStreamAsync(string relativePath);
    }
}


